; (function () {
    //return

    /**
   * @param {number[]} aliceValues
   * @param {number[]} bobValues
   * @return {number}
   */
    var stoneGameVI = function (aliceValues, bobValues) {
        let arrA = []

        aliceValues.forEach((item, index) => {
            arrA[index] = {
                num: Math.abs(item + bobValues[index]),
                index: index
            }

        })
        arrA.sort((a, b) => {
            return b.num - a.num
        })
        let a = 0
        let b = 0
        arrA.forEach((item, index) => {
            if (index % 2 == 0) {
                a += aliceValues[item.index]
            } else {
                b += bobValues[item.index]
            }
        })
        if (a == b) return 0
        if (a > b) return 1
        if (a < b) return -1

    };

    console.log(stoneGameVI([9,8,3,8], [10,6,9,5]));
    
})();